<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <title>强大的flash头像上传插件(支持旋转、拖拽、剪裁、生成缩略图等)</title>
        <meta name="keywords" content="flash头像,flash上传" />
        <meta name="description" content="今天介绍的这款flash上传头像功能非常强大，支持php，asp，jsp，asp.net 调用 头像剪裁，预览组件插件。并且自带摄像头功能。" />
        <link rel="stylesheet" type="text/css" href="http://www.sucaihuo.com/jquery/css/common.css" />
    </head>
    <body>
        <div class="head">
            <div class="head_inner">
                <a class="logo" href="http://www.sucaihuo.com">
                    <img alt="素材火logo" src="http://www.sucaihuo.com/Public/images/logo.jpg"/>
                </a>
            </div>
        </div>
        <div class="container" id="main">
            <h2 class="title"><a href="http://www.sucaihuo.com/js/29.html" target="_blank">强大的flash头像上传插件(支持旋转、拖拽、剪裁、生成缩略图等)</a></h2>
            <div class="demo">
                <p id="swfContainer">
                    本组件需要安装Flash Player后才可使用，请从<a href="http://dl.pconline.com.cn/html_2/1/114/id=8122&pn=0.html" target="_blank">这里</a>下载安装。
                </p>
                <button type="button" id="upload" style="display:none;margin-top:8px;">swf外定义的上传按钮，点击可执行上传保存操作</button> 
            </div>  
        </div>
        <div class="foot">
            Powered by sucaihuo.com  本站皆为作者原创，转载请注明原文链接：<a href="http://www.sucaihuo.com" target="_blank">www.sucaihuo.com</a>
        </div>
        <script type="text/javascript" src="http://www.sucaihuo.com/Public/js/other/jquery.js"></script>
        <script type="text/javascript" src="scripts/swfobject.js"></script>
        <script type="text/javascript" src="scripts/fullAvatarEditor.js"></script>
        <script type="text/javascript">
            swfobject.addDomLoadEvent(function() {
                //以下两行代码正式环境下请删除
                if (location.href.indexOf('http://') == -1)
                    alert('请于WEB服务器环境中查看、测试！\n\n既 http://*/simpleDemo.html\n\n而不是本地路径 file:///*/simpleDemo.html的方式');
                var swf = new fullAvatarEditor("fullAvatarEditor.swf", "expressInstall.swf", "swfContainer", {
                    id: 'swf',
                    upload_url: 'upload.php?userid=999&username=looselive', //上传接口
                    method: 'post', //传递到上传接口中的查询参数的提交方式。更改该值时，请注意更改上传接口中的查询参数的接收方式
                    src_upload: 0, //是否上传原图片的选项，有以下值：0-不上传；1-上传；2-显示复选框由用户选择
                    avatar_box_border_width: 0,
                    avatar_sizes: '100*100|50*50|32*32',
                    avatar_sizes_desc: '100*100像素|50*50像素|32*32像素'					
                }, function(msg) {
                    switch (msg.code)
                    {
                        case 1 :
//                            alert("页面成功加载了组件！");
                            break;
                        case 2 :
//                            alert("已成功加载图片到编辑面板。");
                            document.getElementById("upload").style.display = "inline";
                            break;
                        case 3 :
                            if (msg.type == 0)
                            {
                                alert("摄像头已准备就绪且用户已允许使用。");
                            }
                            else if (msg.type == 1)
                            {
                                alert("摄像头已准备就绪但用户未允许使用！");
                            }
                            else
                            {
                                alert("摄像头被占用！");
                            }
                            break;
                        case 5 :
						console.log(msg);
                            if (msg.type == 0)
                            {
							
                                if (msg.content.sourceUrl)
                                {
                                    alert("原图已成功保存至服务器，url为：\n" + 　msg.content.sourceUrl + "\n\n" + "头像已成功保存至服务器，url为：\n" + msg.content.avatarUrls.join("\n\n") + "\n\n传递的userid=" + msg.content.userid + "&username=" + msg.content.username);
                                }
                                else
                                {
                                    alert("头像已成功保存至服务器，url为：\n" + msg.content.avatarUrls.join("\n\n") + "\n\n传递的userid=" + msg.content.userid + "&username=" + msg.content.username);
                                }
                            }
                            break;
                    }
                }
                );
                document.getElementById("upload").onclick = function() {
                    swf.call("upload");
                };
            });
        </script>
    </body>
</html>

